home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2006 May / PCpro_2006_05.ISO / files / mobile / fma-2.0-stable-setup.exe / {app} / sframework / plugins / SmsMDBLog.vbs-disabled < prev    next >
Encoding:
Text File  |  2005-01-05  |  2.3 KB  |  76 lines

  1. '-------------Save as a plugin and it will write the SMS to Database---------
  2.  
  3. 'Credit where credit due. ie none to me (orac) as copied, changed and messed around for hours just to get it to work
  4.  
  5. 'C:\SMSText.mdb is path to MS Access Database
  6. 'SMSCollection is Table name
  7. 'SMSCollection Table has at least two fields named Msg and Sender, mine has a defaulted Now() field and automatic ID field.
  8.  
  9.  
  10. Class SmsMDBLog
  11.         
  12.         Private m_Self
  13.         Private m_WinampState
  14.         
  15.         'Some info about the plugin
  16.         Public Property Get SHOWABLE() 'Do I have a menu?
  17.                 SHOWABLE = False
  18.         End Property
  19.         Public Property Get TITLE() 'What's my name?
  20.                 TITLE = "On SMS Write DB"
  21.         End Property
  22.         Public Property Get DESCRIPTION() 'What's my purpose?
  23.                 DESCRIPTION = "This will Append the new SMS to File"
  24.         End Property
  25.         Public Property Get AUTHOR() 'Who created me?
  26.                 AUTHOR = "orac"
  27.         End Property
  28.         Public Property Get URL() 'Were can I be found? Where can you get more information?
  29.                 URL = "No where yet"
  30.         End Property
  31.         
  32.         'Who am I?
  33.         Public Property Let Self(s)
  34.                 m_Self = s
  35.                                 
  36.                 EventManager.RegisterEvent "NewSMS", s & ".WriteSMS", Me
  37.         End Property
  38.         
  39.         Public Property Get Self()
  40.                 Self = m_Self
  41.         End Property
  42.         
  43.         Sub WriteSMS(S, T)
  44.         Dim adoCon, rs, strSql
  45.             
  46.         Set adoCon = CreateObject("ADODB.Connection")
  47.          'Set an active connection to the Connection object using a DSN-less connection
  48.         adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ= C:\SMSText.mdb"
  49.  
  50.  
  51.         'Create an ADO recordset object
  52.         Set rs = CreateObject("ADODB.Recordset")
  53.         
  54.         'Initialise the strSQL variable with an SQL statement to query the database
  55.         strSQL = "SELECT SMSCollection.* FROM SMSCollection"
  56.             
  57.         rs.CursorType = 2
  58.         rs.LockType = 3
  59.  
  60.         rs.Open strSQL, adoCon
  61.         rs.AddNew 
  62.             
  63.         Dim Sender, text
  64.         text = T
  65.         Sender = S
  66.         Debug.DebugMsg "Saving NewSMS to Database " & "C:\SMSText.mdb"
  67.         rs.Fields("Msg") = text
  68.         rs.Fields("Sender") = Sender
  69.         rs.update
  70.             
  71.         Set rs = Nothing
  72.         Set adoCon = Nothing
  73.     End Sub
  74.         
  75. End Class
  76.